/**
 * 
 */
package com.java.test.system.dto;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.time.LocalDateTime;
import java.time.ZoneOffset;

import org.springframework.jdbc.core.RowMapper;

import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * @author 登陆账号
 *
 */
public class LoginAccountInfo implements RowMapper<LoginAccountInfo> {

	// 主键id
	private int id;

	// 员工姓名
	private String realName;

	// 登陆账号
	private String loginAccout;

	// 账号密码
	private String passWord;
	
	// 新密码
	private String newpaassWord;
	

	// 角色id
	private int roleId;

	// 角色名称
	private String roleName;

	// 创建时间
	@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private LocalDateTime createTime;

	// 状态 0 ：1 正常: 2禁用
	private int status;

	private String ip;
	
	private String tokenVerify;
	
	

	public String getTokenVerify() {
		return tokenVerify;
	}

	public void setTokenVerify(String tokenVerify) {
		this.tokenVerify = tokenVerify;
	}

	public String getIp() {
		return ip;
	}

	public void setIp(String ip) {
		this.ip = ip;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getRealName() {
		return realName;
	}

	public void setRealName(String realName) {
		this.realName = realName;
	}

	public String getLoginAccout() {
		return loginAccout;
	}

	public void setLoginAccout(String loginAccout) {
		this.loginAccout = loginAccout;
	}

	public String getPassWord() {
		return passWord;
	}

	public void setPassWord(String passWord) {
		this.passWord = passWord;
	}

	public int getRoleId() {
		return roleId;
	}

	public void setRoleId(int roleId) {
		this.roleId = roleId;
	}

	public String getRoleName() {
		return roleName;
	}

	public void setRoleName(String roleName) {
		this.roleName = roleName;
	}

	public LocalDateTime getCreateTime() {
		return createTime;
	}

	public void setCreateTime(LocalDateTime createTime) {
		this.createTime = createTime;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}
	
	
	public String getNewpaassWord() {
		return newpaassWord;
	}

	public void setNewpaassWord(String newpaassWord) {
		this.newpaassWord = newpaassWord;
	}

	@Override
	public LoginAccountInfo mapRow(ResultSet rs, int rowNum) throws SQLException {

		LoginAccountInfo info = new LoginAccountInfo();

		info.setId(rs.getInt("id"));
		info.setLoginAccout(rs.getString("login_account"));
		info.setPassWord(rs.getString("password"));
		info.setRealName(rs.getString("real_name"));
		info.setRoleId(rs.getInt("role_id"));
		info.setRoleName(rs.getString("role_name"));
		info.setCreateTime(rs.getTimestamp("create_time") == null ? null
				: rs.getTimestamp("create_time").toInstant().atZone(ZoneOffset.ofHours(8)).toLocalDateTime());
		info.setStatus(rs.getInt("status"));
		
		return info;
	}

}
